﻿namespace IDAL
{
    /// <summary>
    /// 接口  规则
    /// </summary>
    public interface IBaseDAL<T>
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="t">数据对象</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddAsync(T t);
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="list">数据对象集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddRangeAsync(List<T> list);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="t">数据对象</param>
        /// <returns>返回受影响行数</returns>
        Task<int> DeleteAsync(T t);
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="list">数据对象集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> DeleteRangeAsync(List<T> list);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t">数据对象</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="list">数据对象集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateRangeAsync(List<T> list);
        /// <summary>
        /// 延迟执行 解决查询
        /// </summary>
        /// <returns>返回 IQueryable<T> 对象</returns>
        IQueryable<T> GetAllAsync();
    }
}
